<template>
  <el-dialog
    v-el-drag-dialog
    :title="$t('userDetail')"
    :visible.sync="openSheet"
    width="500px"
    append-to-body
    :destroy-on-close="true"
    :close-on-click-modal="false"
  >
    <el-form ref="form" disabled :model="form" label-width="120px">
      <el-form-item :label="$t('user_userName')">
        <el-input v-model="form.username" />
      </el-form-item>
      <el-form-item :label="$t('user_name')">
        <el-input v-model="form.name" />
      </el-form-item>
      <el-form-item :label="$t('userEmail')">
        <el-input v-model="form.email" />
      </el-form-item>
      <el-form-item :label="$t('userRoleDesc')">
        <el-input v-model="form.role_desc" />
      </el-form-item>
      <el-form-item :label="$t('userIsActive')">
        <el-switch
          v-model="form.is_active"
        />
      </el-form-item>
      <el-form-item :label="$t('userValidDate')">
        <el-date-picker v-model="form.valid_date" type="date" />
      </el-form-item>
      <el-form-item :label="$t('userInvalidDate')">
        <el-date-picker v-model="form.invalid_date" type="date" />
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="cancel">{{ $t('cancel') }}</el-button>
    </div>
  </el-dialog>
</template>

<script>
import elDragDialog from '@/directive/el-drag-dialog'
export default {
  directives: { elDragDialog },
  data() {
    return {
      openSheet: false,
      form: {}
    };
  },
  methods: {
    openSheetDialog(data) {
      this.openSheet = !this.openSheet;
      this.form = data;
    },
    cancel() {
      this.openSheet = !this.openSheet;
    }
  }
};
</script>

<style></style>
